package controller_admin

import (
	"github.com/doujunyu/gogo/job"
	"go_self/server"
)


// CheckToken 登录检查
func CheckToken(j *job.Job) {
	if j.GroupData["token"] == nil {
		j.JsonError(nil, "请先登录", 2)
		return
	}
	//验证token
	tokenData, err := server.AdminGetToken(j.GroupData["token"].(string))
	if err != nil {
		j.JsonError(nil, "登录状态已过期", 2)
		return
	}
	j.GroupData["admin_id"] = tokenData.AdminId

}
